/**
 * Created by mac on 2017/7/3.
 */
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View
} from 'react-native';

import {TabNavigator,TabBarBottom} from 'react-navigation';

import Home from './Home';

import TabBarItem  from './TabBarItem';

import MyScreen from './MyScreen';


const  Tab = TabNavigator(
    {
        Home:{
            screen:Home,
            navigationOptions:({navigation})=>({
                tabBarLabel:'首页',
                tabBarIcon:({focused,tintColor})=>(
                    <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./images/icon-home@2x.png')}
                        selectedImage={require('./images/icon-home-active@2x.png')}
                    />
                )

            }),
        },
        Sort: {
            screen:MyScreen,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '分类',
                tabBarIcon: ({ focused, tintColor }) => (
                    <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./images/icon-classify@2x.png')}
                        selectedImage={require('./images/icon-classify-active@2x.png')}
                    />
                )
            }),
        },
        Food: {
            screen:MyScreen,
            navigationOptions: ({navigation})=>({
                tabBarLabel: '投食',
                tabBarIcon: ({ focused, tintColor }) => (
                    <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./images/icon-privilege@2x.png')}
                        selectedImage={require('./images/icon-privilege-active@2x.png')}
                    />
                )
            })
        },
        Cart: {
            screen:MyScreen,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '购物车',
                tabBarIcon: ({ focused, tintColor }) => (
                    <TabBarItem
                        index = {3}
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./images/icon-cart-active@2x.png')}
                        selectedImage={require('./images/icon-cart-active@2x.png')}
                    />
                )
            }),
        },
        Mine: {
            screen:MyScreen,
            navigationOptions: ({ navigation }) => ({
                tabBarLabel: '个人中心',
                tabBarIcon: ({ focused, tintColor }) => (
                    <TabBarItem
                        tintColor={tintColor}
                        focused={focused}
                        normalImage={require('./images/icon-privilege@2x.png')}
                        selectedImage={require('./images/icon-privilege-active@2x.png')}
                    />
                )
            }),
        },

    },
    {
        tabBarComponent: TabBarBottom,
        tabBarPosition: 'bottom',
        swipeEnabled: false,
        animationEnabled: false,
        lazy: true,
        tabBarOptions: {
            activeTintColor:'#66b219',
            inactiveTintColor: 'black',
            style: { backgroundColor: 'white',borderTopColor:'white',borderTopWidth:1 },
        },
    }
);

export default Tab;